#include "creategroup.h"
#include "ui_creategroup.h"

createGroup::createGroup(SelfInfo info, TcpClient *tcp, QWidget *parent)
    : QWidget(parent), ui(new Ui::createGroup), t(tcp), info(info) {
    ui->setupUi(this);
    msgBox = new QMessageBox(this);
}

createGroup::~createGroup() { delete ui; }

void createGroup::on_pushBtn_Group_clicked() {
    json msg;
    msg.insert("msgid", static_cast<int>(EnMsgType::CREATE_GROUP_MSG));
    msg.insert("groupname", ui->line_groupName->text());
    msg.insert("groupdesc", ui->line_groupDesc->text());
    msg.insert("id", info.account);
    t->SendMsg(msg);
    msgBox->setText("创建群组成功！");
    msgBox->show();
    this->close();
}
